/*
 *  This file is part of LifeBudget - Copyright 2010 Clifton Eaton
 *  ------------------------------------------------------------------
 *  LifeBudget is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  LifeBudget is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with LifeBudget.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.lifebudget.app.client.mvc.model;

import java.io.Serializable;

import com.extjs.gxt.ui.client.data.BeanModelTag;

/**
 * A CategoryAmount represents a Category with an associated dollar amount. 
 * It is used to support the {@link PaycheckCalculator} only. 
 * 
 * Serves as model object to the view as well as a Data Transfer Object and 
 * therefore, meant to be used only in the client code or for communicating 
 * to through GWT RPC.
 */
public class CategoryAmount implements BeanModelTag, Serializable {
	
	/** The id. */
	private long id;
	
	/** The paycheck calc id. */
	private long paycheckCalcId;
	
	/** The category. */
	private Category category;

	/** The amount. */
	private double amount;

	/**
	 * Instantiates a new category amount.
	 */
	public CategoryAmount() {

	}

	/**
	 * Instantiates a new category amount. This is the prefered constructor
	 * as this object should be associated with a parent {@link PaycheckCalculator}.
	 *
	 * @param paycheckParentId the id of the parent paycheck calculator.
	 */
	public CategoryAmount(long paycheckParentId) {
		super();
		this.paycheckCalcId = paycheckParentId;
	}

	/**
	 * Instantiates a new category amount.
	 *
	 * @param categoryName the category name
	 * @param category the category
	 * @param amount the amount
	 */
	public CategoryAmount(String categoryName, Category category, double amount) {
		super();
		this.category = category;
		this.amount = amount;
	}

	/**
	 * Gets the amount.
	 *
	 * @return the amount
	 */
	public double getAmount() {
		return amount;
	}

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * Gets the paycheck calculator id.
	 *
	 * @return the paycheck calculator id
	 */
	public long getPaycheckCalcId() {
		return paycheckCalcId;
	}

	/**
	 * Sets the amount.
	 *
	 * @param amount the new amount
	 */
	public void setAmount(double amount) {
		this.amount = amount;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * Sets the paycheck calc id.
	 *
	 * @param paycheckCalcId the new paycheck calculator id
	 */
	public void setPaycheckCalcId(long paycheckCalcId) {
		this.paycheckCalcId = paycheckCalcId;
	}

	/**
	 * Sets the category.
	 *
	 * @param category the new category
	 */
	public void setCategory(Category category) {
		this.category = category;
	}

	/**
	 * Gets the category.
	 *
	 * @return the category
	 */
	public Category getCategory() {
		return category;
	}

}
